﻿using System.Collections.Generic;
using System.Linq;
using StudentInfo.Areas.StudentArea.ViewModels;

namespace StudentInfo.Areas.StudentArea.ViewModelHelpers
{
    public class ExamViewModelHelper
    {
        public static ExamViewModel PopulateExamViewModel(Exam exam)
        {
            return new ExamViewModel
            {
                Id = exam.Id,
                ExamName = exam.ExamName
            };
        }

        public static List<ExamViewModel> PopulateExamViewModelList(List<Exam> examList)
        {
            return examList.Select(s => PopulateExamViewModel(s)).ToList();
        }

        public static Exam PopulateExamFromViewModel(ExamViewModel model)
        {
            return new Exam
            {
                Id = model.Id,
                ExamName = model.ExamName
            };
        }
    }
}